package com.example.yuan0603;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

import com.example.yml0528.MainActivity;
import com.example.yml0528.User;

public class MyReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        boolean code = intent.getBooleanExtra("code", false);
        if (code) {
            User user = (User) intent.getSerializableExtra("user");
            Intent intent1=new Intent();
            intent1.setClass(context, MainActivity.class);
            context.startActivity(intent1);
            Toast.makeText(context, user.getUsername()+"Login Success", Toast.LENGTH_SHORT).show();
        }
    }
}
